package cn.edu.zut.salarymanagesystem.utils;

import java.util.Objects;

import cn.edu.zut.salarymanagesystem.bean.pojo.Append;
import cn.edu.zut.salarymanagesystem.bean.pojo.Work;
import cn.edu.zut.salarymanagesystem.bean.pojo.WorkRecord;

public class WorkRecordTransform {
    //ture表示Work  false表示Append
    public static WorkRecord transform(boolean flag, WorkRecord workRecord) {
        if (Objects.isNull(workRecord)) {
            WorkRecord record = new WorkRecord();
            record.setCommentary("Transform get  null object!");
            record.setObjectName("Transform get  null object!");
            record.setOwner("Transform get  null object!");
            return record;
        }
        if (true) {
            return new Work(workRecord.getOwner(), workRecord.getTime(), workRecord.getObjectName(), workRecord.getNumber(), workRecord.getValue(), workRecord.getValid(), workRecord.getCommentary());
        } else {
            return new Append(workRecord.getOwner(), workRecord.getTime(), workRecord.getObjectName(), workRecord.getNumber(), workRecord.getValue(), workRecord.getValid(), workRecord.getCommentary());
        }
    }
}
